# Maintainer: Oscar Fuentes <ofv@wanadoo.es>

_realname=tklib
pkgbase=mingw-w64-${_realname}-git
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-git"
pkgver=r1737.65490b01
pkgrel=1
pkgdesc="A companion to Tcllib, for Tk related packages (mingw-w64)"
arch=('any')
provides=("${MINGW_PACKAGE_PREFIX}-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-${_realname}")
url='https://core.tcl.tk/tklib/home'
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-tk" "${MINGW_PACKAGE_PREFIX}-tcllib")
source=("git+https://github.com/tcltk/tklib.git")
sha256sums=('SKIP')

pkgver() {
  cd "${_realname}"
  printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd ${srcdir}/${_realname}
  ./configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST}
  make all
}

package() {
  cd ${srcdir}/${_realname}
  make DESTDIR="${pkgdir}" install
  mkdir -p ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/
  cp license.terms ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
}
